<template>
	<view class="container">
		<view class="order-box">
			<view class="order-item">
				<view class="item-left">
					<view class="item-icon">●</view>
					<view class="item-title">招办专家一对一</view>
				</view>
				<view class="item-price">¥ 599</view>
			</view>
			<view class="order-item">
				<view class="item-left">
					<view class="item-icon">●</view>
					<view class="item-title">优惠码填写</view>
				</view>
				<view class="item-input">
					<input placeholder-class="input-placeholder" placeholder="优惠码" />
				</view>
			</view>
			<view class="order-item">
				<view class="item-left">
					<view class="item-icon">●</view>
					<view class="item-title">优惠</view>
				</view>
				<view class="item-discount-price">- ¥ 100</view>
			</view>
			<view class="order-payabel">
				<view class="item-payabel-price-label">实际应付</view>
				<view class="item-payabel-price">¥ 499</view>
			</view>
		</view>
		<view class="line"></view>
		<view class="pay-box">
			<view class="pay-item" v-for="(item,index) in payList" :key="index">
				<view class="item-logo-label">
					<view class="pay-logo">
						<image :src="item.logo"></image>
					</view>
					<view class="pay-label">{{item.name}}</view>
				</view>
				<view class="pay-select" @tap="selectPay(index)">
					<image v-show="!item.isChecked" src="../../static/images/pay_select_no.png"></image>
					<image v-show="item.isChecked" src="../../static/images/pay_select_yes.png"></image>
				</view>
			</view>
		</view>
		<view class="submit-btn" @tap="goPaySuccess">确认支付</view>
		<view class="tip">温馨提示：虚拟商品，一经支付概不退款</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				payList: [
					{id: 1, name: '微信支付', logo: '../../static/images/wechat_pay.png', isChecked: true},
					{id: 2, name: '支付宝支付', logo: '../../static/images/ali_pay.png', isChecked: false}
				],
				payIndex: 0
			}
		},
		
		methods: {
			
			selectPay(index) {
				if (this.payIndex != index) {
					this.payList[this.payIndex].isChecked = false
					this.payList[index].isChecked = true
					this.payIndex = index
				}
			},
			
			goPaySuccess() {
				uni.redirectTo({
					url: '/pages/pay_success/pay_success'
				})
			}
			
		}
	}
</script>

<style>
	.container {
		width: 750rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	
	.order-box {
		width: 660rpx;
	}
	
	.order-item {
		width: 100%;
		height: 90rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		border-bottom: 2rpx solid #eeeeee;
	}
	
	.item-left {
		display: flex;
		flex-direction: row;
	}
	
	.item-icon {
		color: #999999;
		font-size: 20rpx;
		margin-top: 6rpx;
	}
	
	.item-title {
		color: #333333;
		font-size: 30rpx;
		margin-left: 16rpx;
	}
	
	.item-price {
		color: #333333;
		font-size: 30rpx;
	}
	
	.input-placeholder {
		font-size: 30rpx;
		color: #999999;
		margin-left: 20rpx;
	}
	
	.item-input input {
		width: 110rpx;
		color: #ff744f;
		font-size: 30rpx;
	}
	
	.item-discount-price {
		color: #ff744f;
		font-size: 30rpx;
	}
	
	.order-box {
		margin-top: 20rpx;
	}
	
	.order-payabel {
		width: 100%;
		height: 100rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: flex-end;
	}
	
	.item-payabel-price-label {
		color: #999999;
		font-size: 30rpx;
	}
	
	.item-payabel-price {
		font-size: 48rpx;
		color: #e1805b;
	}
	
	.line {
		width: 750rpx;
		height: 18rpx;
		background-color: #f5f5f5;
		margin-top: 60rpx;
	}
	
	.pay-box {
		width: 660rpx;
		margin-top: 40rpx;
	}
	
	.pay-item {
		width: 100%;
		height: 120rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		border-bottom: 2rpx solid #eeeeee;
	}
	
	.item-logo-label {
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	
	.pay-logo image {
		width: 70rpx;
		height: 70rpx;
	}
	
	.pay-label {
		margin-left: 30rpx;
		margin-bottom: 6rpx;
	}
	
	.pay-select image {
		width: 40rpx;
		height: 40rpx;
	}
	
	.submit-btn {
		width: 700rpx;
		height: 78rpx;
		background: linear-gradient(90deg, #ff8806, #fbae2b);
		color: #ffffff;
		font-size: 36rpx;
		border-radius: 40rpx;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		margin-top: 78rpx;
	}
	
	.tip {
		margin-top: 220rpx;
		font-size: 24rpx;
		color: #666666;
	}
</style>
